Script for Batch Processing - Scripted Render Name

I’ve been using gen ai to help write a script which assigns a material way (driven by an Excel sheet) and then queues a set of studios. To finish the script, I’m trying to have it auto-input the render name using data provided (again driven by an Excel sheet). However, I can’t seem to find a command for instructing a render name. According to the gen ai, there was a command in the past for this, or it may be hidden?

hi @sebastian.verweij Below is an example script that queues renders per names in a CSV.

Here’s a snippet for custom file names:

# Render the image with the customized file name and current render options
lux.renderImage(file_name, width=1920, height=1080, opts=render_options)
print(f"Queued render for image style '{image_style_name}' as: {file_name}")
# AUTHOR LUX DT ChatGPT
# VERSION 1.1.0
# Queue renders using 'Color Name' from CSV as filenames (standard Python only).

import csv
import os
import lux

def load_color_names(csv_path):
    """
    Reads 'Color Name' from the CSV and returns a list of cleaned filenames.
    """
    file_names = []
    with open(csv_path, newline='', encoding='utf-8') as csvfile:
        reader = csv.DictReader(csvfile)
        for row in reader:
            color_name = row.get("Color Name", "").strip()
            if color_name:
                file_names.append(f"{color_name}_render.png")
    return file_names

def queue_render_images(csv_path, output_folder):
    # Load filenames from the CSV
    file_names = load_color_names(csv_path)

    # Get render options and configure queueing
    render_options = lux.getRenderOptions()
    render_options.setAddToQueue(True)

    for file_name in file_names:
        full_path = os.path.join(output_folder, file_name)

        # Queue render
        lux.renderImage(full_path, width=1920, height=1080, opts=render_options)
        print(f"Queued render: {full_path}")

    # Commit the queue (REQUIRED)
    # lux.processQueue()

# Usage
csv_input_path = "C:/Users/Public/Documents/KeyShot Studio/scripts/CSV/colorways.csv"
output_folder = "C:/Users/Public/Documents/KeyShot Studio/Renderings/"
queue_render_images(csv_input_path, output_folder)
3 Likes

Amazing! Thanks so much, I’ll give it a whirl.

1 Like